package com.lyc.common.enums;

import java.util.stream.Stream;

public enum NodeCodeEnum {
    SUPERVISON_APPROVAL("SUPERVISON_APPROVAL","部门审批"),
    OCCUPATIONAL_HEALTH("OCCUPATIONAL_HEALTH","职业健康");
    private String nodeCode;
    private String nodeDesc;

    NodeCodeEnum(String nodeCode, String nodeDesc) {
        this.nodeCode = nodeCode;
        this.nodeDesc = nodeDesc;
    }

    public String getNodeCode() {
        return nodeCode;
    }

    public String getNodeDesc() {
        return nodeDesc;
    }

    /**
     * 传递什么，就返回什么
     * @param nodeCode
     * @return
     */
    public static NodeCodeEnum getEnumByNodeCode(String nodeCode){
        return Stream.of(NodeCodeEnum.values())
                .filter(p -> p.nodeCode.equals(nodeCode))
                .findAny()
                .orElse(null);
    }
}
